<?
include('header.php');



  $site2 = mysql_query("SELECT * FROM `dailyb` WHERE `active` = '0' AND `id` NOT IN (SELECT `site_id` FROM `daily` WHERE `user_id`='".$data['id']."') ORDER BY `cpc` DESC LIMIT 0, 1");
  $ext = mysql_num_rows($site2);
?>
<div class="block medium right">
			<div class="top"><?if(isset($data['id'])) {?>	
                  <h1>Daily Bonus</h1>
            </div>
			<div class="content">	
<?
if($ext > 0){
?>
<p>You can receive the Daily Coin Bonus once every 24 hours!</p>
<script>
var user= "<? echo $data['id'];?>";
function skipuser(str,username) {
document.getElementById("txtHint").style.display='block';
	$("#txtHint").html('<table cellpadding="2" cellspacing="0" width="500" align="center" class="maintable"><tr><td align="center"><font size="3"><b>Claiming Bonus...</b></font></td></tr><tr><td><center><font size=2><b>Claiming Bonus...</b></font></center></td></tr></table><br>');
	$.ajax({
		type: "GET",
		url: "getbonus.php?step=skip",
		data: "id="+str+"&usr="+user,
		success: function(msg){
			$("#txtHint").html(msg);
		}
	});
	remove(str);
}
function followuser(str,username)
{
document.getElementById("txtHint").style.display='block';
	$("#txtHint").html('<table cellpadding="2" cellspacing="0" width="500" align="center" class="maintable"><tr><td align="center"><font size="3"><b>Did you follow @'+username+'?</b></font></td></tr><tr><td><center><font size=2><b>Verifying... </b></font></center></td></tr></table><br>');
	$.ajax({
		type: "GET",
		url: "follow.php",
		data: "id="+str+"&usr="+user,
		success: function(msg){
			$("#txtHint").html(msg);
		}
	});
}

function remove(Variable) {
document.getElementById("follow"+Variable).style.display='none';
}
</script>
<center><div id="txtHint" style="display:none;"></div></center>
<div id="getpoints">
<?
  for($j=1; $site = mysql_fetch_object($site2); $j++){
?>	
<div class="follow" id="follow<? echo $site->id;?>"><center><br><font color="black"><b>Coins</b>: <? echo $site->cpc;?></font><br><center><a href="javascript:void(0);" onclick="skipuser('<? echo $site->id;?>','<? echo $data['id'];?>');" style="color: #666666;font-size:0.9em;" class="followbutton"><font color="black">GET BONUS</font></a>
<?}?>
</div>
<br>
<div class='infobox'><font color="black">Click Get Bonus and refresh page to see the addition of Coins!</font>
<form action='' method='' onsubmit='refreshpage();'>
<input name='refresh' type='submit' value='Refresh'>
</form></div></div>
<?}else{?>
<div class="msg">
<div class="error">Sorry, You have already received the Daily Bonus today. Please try again tommorrow.</div>
<div class="info"><a href="buycoins.php"><b>Feel like you need more coins? You can purchase them now!</b></a></div>
</div>
<?}}else{?><script>document.location.href='index.php'</script><?}?>
				</div>
			</div>	
	
<?include('footer.php');?>